Web Server 加速

最近在測 WordPress, 發現網頁打開速度真的很慢 一開始是以為是網頁的圖檔太多, 後來用了幾個網站Check才發現不是

找了一下, 大概有三個地方是應該調整, 至少是裝好 freeBSD 後, 如果你的軟體是用 port 安裝的, 大概都不會有的:

第一個是 php 的部份:

php 可以加掛 eAccelerator – 這是一套 php 的加速軟體, 安裝方式簡單說明如下:

# cd /usr/ports/www/eaccelerator # make install

安裝完成前應該會看到一段該死的指示: You have installed the eaccelerator package.

Edit /usr/local/etc/php.ini and add:

zend_extension=”/usr/local/lib/php/20050922/eaccelerator.so”

Then create the cache directory:

mkdir /tmp/eaccelerator chown www /tmp/eaccelerator chmod 0700 /tmp/eaccelerator

你如果照作大概就會打開不了網頁, as usual google 一下, 知道要修改兩個地方:

1, 打開 /usr/local/etc/php/extension.ini , 在檔案的最後面加上: extension=eaccelerator.so

2, 再打開 /usr/local/etc/php.ini , 在檔案的最後面加上這些設定:

eaccelerator.shm_size=”16″ eaccelerator.cache_dir=”/tmp/eaccelerator” eaccelerator.enable=”1″ eaccelerator.optimizer=”1″ eaccelerator.check_mtime=”1″ eaccelerator.debug=”0″ eaccelerator.filter=”” accelerator.shm_max=”0″ eaccelerator.shm_ttl=”0″ eaccelerator.shm_prune_period=”0″ eaccelerator.shm_only=”0″ eaccelerator.compress=”1″ eaccelerator.compress_level=”9″

檢查 eAccelerator 是否載入的方法如下:

# /usr/local/bin/php -v PHP […]